<!--
 * @Description: 
 * @version: 
 * @Author: liurui
 * @Date: 2024-02-05 15:49:40
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2024-02-06 09:44:44
-->
<template>
    <div>

    </div>
</template>

<script setup lang="ts">
// 实现一个类型，把驼峰命名转换为短斜杠命名

type FooBarBaz = KebabCase<'FooBarBaz'>;
const foobarbaz: FooBarBaz = 'foo-bar-baz';

type DoNothing = KebabCase<'do-nothing'>;
const doNothing: DoNothing = 'do-nothing';

type KebabCase<S extends string, isFirst = true> =
  S extends `${infer First}${infer Rest}`
  ? isFirst extends true ? 
   
  `${Lowercase<First>}${KebabCase<Rest, false>}`
    : First extends Lowercase<First> ?
    `${First}${KebabCase<Rest, false>}`
    : `-${Lowercase<First>}${KebabCase<Rest, false>}`
  : '';
</script>

<style scoped>

</style>